/*---------------------------------------------------------------
 * Confidential and Proprietary
 * Copyright 2006 CMO & Hewlett-Packard Development Company, L.P.
 * All Rights Reserved
 *---------------------------------------------------------------
 * Project Name    : SPF
 * Sub Project Name: SPF
 *
 * Class Name      : SQLExceptionHelper
 * Purpose         : 
 *---------------------------------------------------------------
 * Modification Log
 * Date         Ver. #      Programmer       Description
 *
 * Apr 17, 2006    1.0          qixia          Initial
 *---------------------------------------------------------------
 */
package com.erdos.common.util;

import java.sql.SQLException;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public abstract class SQLExceptionHelper {

	private ResourceBundle rb;

	public SQLExceptionHelper(Locale locale) {
		rb = ResourceBundle.getBundle(getPropertyFile(), locale);
	}

	protected String getErrorMessage(SQLException se) {
		try {
            return rb.getString(String.valueOf(se.getErrorCode()));
        } catch (MissingResourceException mre) {
            return null;
        }
	}

    protected abstract String getPropertyFile() ;
    public abstract String getMessage(SQLException se);
}
